char* int_to_char(int i,char* p) {
    if (i / 10 == 0) {
        *p++ = i + '0';
        *p = '\0';
        return p;
    }
    p = int_to_char(i / 10, p);
    *p++ = i % 10 + '0';
    *p = '\0';
    return p;
}

int strlen(char* string) {
    int len = 0;
    while(*string++ != '\0')
        len++;
    return len;
}

void my_strcopy(char* source,char* dest,int pos) {
    for(int i = 0; i < pos; i++)
        *dest++;
    char c;
    while((c = *source++) != '\0')
        *dest++ = c;
}

void my_strcopy(char* source,char* dest) {
    my_strcopy(source,dest,0);
}

void check_zero(char* string) {
	if(*string == '\0') {
    	*(string) = '0';
    	*(string + 1) = '0';
    	*(string + 2) = '\0';    	
    }
    else if(*(string + 1) == '\0') {
        *(string + 1) = *string;
        *string = '0';
        *(string + 2) = '\0';
    }
}

void print(char* string,int stop) {
	for(int i = 0; i < stop; i++) {
		char c = *(string + i);
		std::cout << i << " = ";
		if(c == '\0')
			std::cout << "NULL";
		else
			std::cout << c;
		std::cout << "\n";
	}
} 	
